Shift It



Play this addictive little JavaScript game - try to put all the pieces in alphabetical order, 'A' through 'O'. Awesome! 
--------------------------------------------------------------------------------
 


<!-- ONE STEP TO INSTALL SHIFT IT:

   1.  Paste the coding into the BODY of your HTML document  -->

<!-- STEP ONE: Copy this coding into the BODY of your HTML document  -->
		  
<BODY>

<center>
<form name=pad>
<table border=2 cellpadding=2 cellspacing=2>
<tr>
<td colspan=4 align=center>Shift It 4x4 Game</td>
</tr>

<SCRIPT LANGUAGE="JavaScript">

<!-- Original:  Dion  -->
<!-- Web Site:  http://members.xoom.com/yoboseyo -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
bx=3; by=3;
for (y=0;y<4;y++) {
document.write('<tr>');
for (x=0;x<4;x++) {
document.write('<td><tt><input type=button value="   " ');
document.write('onclick="move('+x+','+y+');"></tt></td>');
}
document.write('</tr>');
}
function move(x,y) {
ax=Math.abs(bx-x);
ay=Math.abs(by-y);
if (((ax*ay)==0)&&((ax+ay)==1)) {
f=document.pad;
f.elements[4*by+bx].value=f.elements[4*y+x].value;
f.elements[4*y+x].value="   ";
bx=x; by=y; f.msg.value++;
   }
}
function rndize() {
alpha="ABCDEFGHIJKLMNO ";
for (i=0;i<16;i++) {
x=0;
y=0;
while (document.pad.elements[4*y+x].value!="   ") {
x=Math.floor(Math.random()*4);
y=Math.floor(Math.random()*4);
}
document.pad.elements[4*y+x].value=alpha.substring(i,i+1);
}
bx=x;
by=y;
}
rndize();
// End -->
</script>

<tr>
<td colspan=4><input type=text size=20 name=msg></td>
</tr>
</table>
</form>
</center>


<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  1.46 KB  -->
